﻿using System;
using System.Collections.Generic;
using System.Linq;
using Common.Extension;
using Common.util;
using Dapper;

namespace Common.Dao
{
    public class YunFinFilterWordDao
    {
        public static void BatchSaveWord(List<string> topics)
        {
            String sql =
                @"INSERT IGNORE INTO yun_fin_filter_word(`word`) VALUES (@Word)";
            using (var conn = DbUtils.GetHotTopicConnection())
            {
                conn.InsertMultiple(sql, topics.Select(m=>new {Word = m}).ToList());
            }
        }

        public static List<string> GetWord()
        {
            String sql =
                @"SELECT word FROM `yun_fin_filter_word` ";
            using (var conn = DbUtils.GetHotTopicConnection())
            {
                return conn.Query<string>(sql).ToList();
            }
        }
    }
}